package com.wenjunwu.blog.em;

import java.util.HashMap;
import java.util.Map;

public enum OptionEnum {
	OPTION_FREEZE("FREEZE", "冻结"), 
	OPTION_UNFREEZE("UNFREEZE", "解冻"), 
	
	OPTION_CONSOLE("CONSOLE", "控制台"), 
	OPTION_PORTAL("PORTAL", "门户"),
	
	OPTION_VALID("VALID","有效"),
	OPTION_INVALID("INVALID", "无效"),
	
	OPTION_SUCCESS("SUCCESS","成功"),
	OPTION_FAILURE("FAILURE","失败");

	private String value;
	private String displayName;

	private OptionEnum(String value, String displayName) {
		this.value = value;
		this.displayName = displayName;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getDisplayName() {
		return displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	private static Map<String, OptionEnum> map = new HashMap<>();

	static {
		for (OptionEnum _enum : OptionEnum.values()) {
			map.put(_enum.value, _enum);
		}
	}

	public static OptionEnum parseOf(String value) {
		for (OptionEnum item : values()) {
			if (item.getValue().equalsIgnoreCase(value)) {
				return item;
			}
		}
		throw new IllegalArgumentException("系统异常代码[" + value + "]不匹配!");
	}
}
